package com.pingan.internal.point.shopping.service.impl;

import com.pingan.internal.point.shopping.controller.response.DataPageList;
import com.pingan.internal.point.shopping.entity.Address;
import com.pingan.internal.point.shopping.repository.AddressRepository;
import com.pingan.internal.point.shopping.service.AddressService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {
    private static final Logger LOGGER = LoggerFactory.getLogger(AddressServiceImpl.class);

    @Resource
    private AddressRepository addressRepository;

    @Override
    public DataPageList<Address> list(String username) {
        DataPageList<Address> data = new DataPageList<>();
        List<Address> list = addressRepository.findByUsername(username);
        data.putList(list);
        return data;
    }
}
